<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <#include "include/_meta.html">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>

</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-admin-add" >
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户编号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text"
                       value="" placeholder="请输入数字编号" id="uid" name="uid" onkeyup="return ValidateNumber($(this),value)">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入姓名" id="name" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>身份证号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入身份证号" id="idcard" name="idcard" onblur="isIdCard(this.value);">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>性别：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="sex" type="radio" id="sex-1" checked>
                    <label for="sex-1">男</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="sex-2" name="sex">
                    <label for="sex-2">女</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>驾驶证号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入驾驶证号" id="drivernum" name="drivernum">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>企业代号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入企业代号" id="companyid" name="companyid">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text"  class="input-text" value="" placeholder="请输入手机号码" id="mobile" name="mobile" onblur="isMobile(this.value);">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>会员级别：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入1-4的会员级别" id="memlevel" name="memlevel">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客户状态：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="1、正常 2、锁定" id="clientstate" name="clientstate">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">备注：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea id="remark" name="" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" dragonfly="true" onKeyUp="textarealength(this,100)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input id="clientadd" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" />
            </div>
        </div>
    </form>
</article>

<#include "include/_footer.html">

<script type="text/javascript">
$(function () {
    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    })
});

    $("#clientadd").click(function () {
        $.ajax({
            url:'/clientAdd',
            type:'POST',
            dataType:'json',
            data:$('#form-admin-add').serialize(),
            success:function (data) {
                var index = parent.layer.getFrameIndex(window.name);
                parent.getClientList();
                parent.layer.close(index);
            }
        })
    })

    /*文本框内只能输入数字*/
    function ValidateNumber(e,number) {
        if (!/^\d+$/.test(number)){
            $(e).val(/^\d+/.exec($(e).val()));
            alert("请输入数字")
        }
        else {

        return false;
        }
    }

    /*jQuery 对电话号码的限制*/
    //验证电话号码
    function isMobile(mobile) {
        var RegCellMobile=/^(1)([0-9]{10})?$/;
        var flag=mobile.search(RegCellMobile);
        if (flag==-1){
            alert("手机号不正确");
            this.force();
        }
    }

    /*验证身份证号码*/
function isIdCard(idcard){
    var reg=/^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
    if(!reg.test(idcard)){
        alert("身份证号码不正确");
    }
}
</script>
</body>